import React, { Component } from 'react';
import queryString from 'query-string'
import axios from 'axios';
class Index extends Component {
    constructor(props) {
        super(props)
        this.state = {
            detail: []
        }
    }
    render() {
        return (
            <div>
                <img src={this.state.detail.pic} alt="" />
                <h2>{this.state.detail.title}</h2>
                <p>{this.state.detail.slogo}</p>
            </div>
        );
    }
    componentDidMount() {
        let search = window.location.search
        var { id } = queryString.parse(search)
        axios.get(`http://122.112.161.135:4000/api/movieDetail?id=${id}`).then(res => {
            this.setState({
                detail: res.data.res[0]
            })
        })
    }
}

export default Index;